/*
 * Created on Feb 22, 2007 by mbruns
 * Project MultilingualBVMC
 * Package com.broadvision.bvgs.multilang.action
 * TODO 
 */
package com.broadvision.bvgs.multilang.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.DynaValidatorForm;

import com.broadvision.bvgs.multilang.MultilangUtils;
import com.broadvision.data.client.Content;

public class PageTypeMultilangRemoveAction extends PageTypeMultilangViewAction {

    
        public ActionForward processExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
            throws Exception
                {
                        updateMultilang(request, form);
                        Map contextParams = prepareContextParams(request);
                        request.setAttribute("pagetabParam", contextParams);
                        prepareTab(request);

                        return super.processExecute(mapping,form,request, response);
                }
                
                protected void updateMultilang(HttpServletRequest request, ActionForm form){
                        String language = ((DynaValidatorForm) form).getString("languageToRemove");
                        Content content = getContentToTranslate(request);
                        MultilangUtils.removeMultilangName(content, language, getTranslationTableName(), getTranslationLanguageFieldName());
                }

}
